package homework.Day0328;

import java.util.Arrays;
import java.util.Scanner;
import java.util.Stack;

public class BaseConversion {
    public static void main(String[] args) {
        System.out.println("输入要转换的数字，并将其转换为底数，以空格分隔");
        Scanner in = new Scanner(System.in);
        String s = in.nextLine();
        String[] str = s.split("//s+");
        System.out.println(Arrays.toString(str));
        int i1 = Integer.parseInt(str[0]);
        int i2 = Integer.parseInt(str[1]);

        Stack<Integer> stack = new Stack<>();
        int i3;
        while (i1 == 0){
            i1 = i1 / i2;
            i3 = i1%i2;
            stack.push(i3);
        }

        while (!stack.empty()){
            System.out.print(stack.pop());
        }
    }
}
